<?php
class m_perbandingan_nilai extends Model{
    function get_perbandingan_nilai($option){
        $where = "";
        if($option['idMapel'] != ""){
            $where = "where rm.id_mata_pelajaran = $option[idMapel]";
        }
        if($option['tahunAjaran'] != ""){
            if($option['tahunAjaran'] != "all"){
               $where .= " and r.id_tahun_ajaran = $option[tahunAjaran]";                
            }
        }
        $query = $this->db->query("select a.nama as adik_asuh,rm.kkm,rm.nilai_angka,rm.nilai_terbilang,rm.deskripsi_kemajuan_belajar from raport_mapel rm
        join raport r on rm.id_raport = r.id
        join adik_asuh a on r.id_adik_asuh = a.id $where");
        
        if($query->num_rows() > 0){
            $return = $query->result_array();
        }else $return = array();
        
        return $return;
    }
}
?>
